//
//  BIDMemberListHeaderView.m
//  zhangqitong
//
//  Created by mal on 15/12/9.
//  Copyright © 2015年 mal. All rights reserved.
//

#import "BIDMemberListHeaderView.h"

@interface BIDMemberListHeaderView()
{
    BOOL _bSelect;
}
@end

@implementation BIDMemberListHeaderView
@synthesize delegate;

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

- (void)awakeFromNib
{
    _flagLabel.clipsToBounds = YES;
    _flagLabel.layer.cornerRadius = CGRectGetHeight(_flagLabel.frame)/2;
    //
    UITapGestureRecognizer *tapGR = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapHandler:)];
    [_topContainerView addGestureRecognizer:tapGR];
}

- (void)tapHandler:(UITapGestureRecognizer*)tapGR
{
    [delegate checkMemberByPosition];
}

- (void)allChooseOrInchoose:(BOOL)bChoose
{
    if(bChoose)
    {
        //选中
        _bSelect = YES;
        [_imgView setImage:[UIImage imageNamed:@"check_choose.png"]];
    }
    else
    {
        //不选中
        _bSelect = NO;
        [_imgView setImage:[UIImage imageNamed:@"check_inchoose.png"]];
    }
}

- (IBAction)btnDownHandler:(id)sender
{
    if(_bSelect)
    {
        _bSelect = NO;
        [_imgView setImage:[UIImage imageNamed:@"check_inchoose.png"]];
    }
    else
    {
        _bSelect = YES;
        [_imgView setImage:[UIImage imageNamed:@"check_choose.png"]];
    }
    [delegate chooseOrInchoose:_bSelect];
}

@end
